stage.set_background("moon")
sprite = codesters.Sprite("hedgehog")
sprite.go_to(0, -210)
def left():
sprite.turn_left(20)
stage.event_left_key(left)
def right():
sprite.turn_right(20)
stage.event_right_key(right)
def up():
sprite.move_forward(575)
stage.wait(0.1)
sprite.go_to(0, -210)
stage.event_up_key(up)
def interval():
rand_x = random.randint(-250, 250)
rand_y = random.randint(-100, 250)
goal_star = codesters.Star(rand_x, rand_y, 5, 15, "yellow")
# add any other actions...
stage.event_interval(interval, 2)
-
Run Code
-
Activity Submitted!
Enviar Trabajo
-
Actividad Siguiente
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)